package cwb1;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;


/**
 * This class represents a college activity.
 * 
 * @author Aurora
 *
 */
public class College extends LearningTime
{
    // A personal rate for the usefulness of the college activity.
    private long usefulnessRate;
    // A value for the sitting position in the auditorium where the college activity took place.
    private long position;
    // The id of the course of the college.
	private String courseId;

  
    /**
     * This method makes a college (activity) object.
     * 
     * @param startDate The start date of the college activity.
     * @param user The user who has done the college activity.
     * @param course The course for which the college activity is intended.
     */
    public College(Date startDate, String userId, String courseId)
    {
        super(startDate, userId, ActivityFactory.COLLEGE, courseId);
        usefulnessRate = 0;
        position = 0;
    }
    

    /**
     * Creates a college object using a Map for setting the properties. Used by the DataEngine. Be warned, their is no control if the keys match the fieldnames.
     * 
     * TODO: adding the course.
     * 
     * @param properties a Map containing the following keys: keys for an activity, "courseId" with String, "usefulnessRate" with long, "position" with long.
     */
    public College(Map<String, Object> properties) {
    	super(properties);
    	setActivityType(ActivityFactory.COLLEGE);
    	usefulnessRate = (Long) properties.get("usefulnessRate");
    	position = (Long) properties.get("position");
    }

    /**
     * This method returns the properties (personal rates) of the college activity.
     * 
     * return HashMap with the properties (personal rates) as content and the name of the properties as corresponding key.
     */
    public HashMap<String,Object> getProperties() {
    	HashMap<String, Object> properties = super.getProperties();
    	properties.put("usefulnessRate", usefulnessRate);
    	properties.put("position", position);
    	
    	return properties;
    }

    /**
     * This method returns the course for which the college activity is intended to be.
     * 
     * @return The course for which the study college is intended to be.
     */
    public String getCourseId()
    {
        return courseId;
    }
    
    /**
     * This method returns the usefulness rate of the college activity.
     * 
     * @return The usefulness rate of the college activity.
     */
    public long getUsefullnessRate()
    {
        return usefulnessRate;
    }

    /**
     * This method changes the usefulness rate of the college activity to the given value.
     * 
     * @param value The new value for the usefulness rate of the college activity.
     */
    public void setUsefulnessRate(long value)
    {
        usefulnessRate = value;
    }

    /**
     * This method returns the sitting position in the auditorium of the college activity.
     * 
     * @return The sitting position in the auditorium of the college activity.
     */
    public long getPosition()
    {
        return position;
    }
    
    /**
     * This method changes the sitting position in the auditorium of the college activity to the given value.
     * 
     * @param value The new value for the sitting position in the auditorium of the college activity.
     */
    public void setPostion(long value)
    {
        position = value;
    }
}